#pragma once
#include<iostream>
#include<string>
using namespace std;

class OperatorTestClass {
private:
	int PropertyInt;
	string PropertyStr;

public:
	OperatorTestClass():
		PropertyInt(0), PropertyStr("")
	{
	}

	OperatorTestClass(int PropertyInt, string PropertyStr) :
		PropertyInt(PropertyInt), PropertyStr(PropertyStr)
	{
	}

public:
	const string& GetPropertyStr() const {
		return PropertyStr;
	}

	const int GetPropertyInt() const {
		return PropertyInt;
	}

	void SetPropertyStr(const string& str) {
		PropertyStr = str;
	}

	void SetPropertyInt(int i) {
		PropertyInt = i;
	}

public:
	/*
	* 算术运算符 +=
	* 定义在类中, 可以不返回值
	* 由于是类成员函数, this绑定到左侧运算对象中
	* 
	* 1. 形参表示右侧的运算对象
	*/
	OperatorTestClass& operator+=(const OperatorTestClass& c) {
		PropertyInt += c.GetPropertyInt();
		PropertyStr += c.GetPropertyStr();
		return *this;
	}
};


